{% extends 'adminbase.html' %}
{% block content_admin %}
	
	Updating Slideshow :

	{% if slideshow %}
		{{ slideshow.title }} [<a href="/admin/admin_detailslideshow/{{slideshow.pk}}/">View</a>]
		
		<form action="/admin/admin_updateslideshow/{{slideshow.pk}}/" method="post">
		    <table>
		    {{form.as_table}}
		    </table>
		    <input type="submit" value="submit">
		</form>
	{% else %}
	    <p>No slideshow found.</p>
	{% endif %}

{% endblock %}

{% block content_admin_menu %}

	{% if slideshow %}
		<h3 class="page-content-menu-tab">Page</h3>
		<form action="/admin/admin_updatelink_slideshowpage/{{slideshow.pk}}/" method="post" class="page-list-item">
			<input type="hidden"  name="slideshow_pk"  value="{{slideshow.pk}}">
			<input type="hidden"  name="return_url"  value="/admin/admin_updateslideshow/{{slideshow.pk}}/">
			<SELECT name="selected_page">
		        {% for page in page_list %}
					<OPTION VALUE="{{ page.pk }}">{{ page.title }}</OPTION>
			    {% endfor %}
			</SELECT>
			<INPUT type="submit" value="Add">
		</form>
		
		{% for pageLink in page_linked_list %}
		<div class="page-list-item">
			[<a title="Remove" class="page-list-item-action-remove" 
				href="/admin/admin_deletelink_slideshowpage/{{pageLink.pk}}/
							?return_url=/admin/admin_updateslideshow/{{slideshow.pk}}/">-</a>]
			<a class="page-list-item-link" href="/admin/admin_detailpage/{{pageLink.page.pk}}/">
				{{ pageLink.page.title }}
			</a>
		</div>
	    {% endfor %}
		
		<h3 class="page-content-menu-tab">Photo</h3>
		<form action="/admin/admin_updatelink_photoslideshowBySlideshow/{{slideshow.pk}}/" method="post" class="page-list-item">
			<input type="hidden"  name="slideshow_pk"  value="{{slideshow.pk}}">
			<input type="hidden"  name="return_url"  value="/admin/admin_updateslideshow/{{slideshow.pk}}/">
			<SELECT name="selected_photo">
		        {% for photo in photo_list %}
					<OPTION VALUE="{{ photo.pk }}">{{ photo.title }}</OPTION>
			    {% endfor %}
			</SELECT>
			<INPUT type="submit" value="Add">
		</form>
		
		{% for photoLink in photo_linked_list %}
		<div class="page-list-item">
			[<a title="Remove" class="page-list-item-action-remove"
				href="/admin/admin_deletelink_photoslideshow/{{photoLink.pk}}/
							?return_url=/admin/admin_updateslideshow/{{slideshow.pk}}/">-</a>]
			<a class="page-list-item-link" href="/admin/admin_detailphoto/{{photoLink.photo.pk}}/">{{ photoLink.photo.title }}</a>
		</div>
	    {% endfor %}
	    
    {% endif %}
{% endblock %}